%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/conditions/archived-forum-inherited-messages.defer-3"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 9, 10, 65, 66, 11, 13, 28<br />2: PgSelect[8]<br />3: PgSelectRows[14]"):::bucket
    Bucket1("Bucket 1 (listItem)<br />Deps: 11, 28<br /><br />ROOT __Item{1}ᐸ14ᐳ[15]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 16, 11, 28<br /><br />ROOT PgSelectSingle{1}ᐸforumsᐳ[16]<br />1: <br />ᐳ: 17, 19, 25<br />2: PgSelect[20]<br />3: Connection[24]<br />4: ConnectionItems[29]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 20, 24, 29, 11<br /><br />ROOT Connection{2}ᐸ20ᐳ[24]"):::bucket
    Bucket4("Bucket 4 (defer)<br />Deps: 29, 11, 24"):::bucket
    Bucket5("Bucket 5 (defer)<br />Deps: 39, 29, 11, 24"):::bucket
    Bucket8("Bucket 8 (listItem)<br />Deps: 11<br /><br />ROOT __Item{8}ᐸ29ᐳ[34]"):::bucket
    Bucket9("Bucket 9 (listItem)<br />Deps: 39, 11<br /><br />ROOT __Item{9}ᐸ29ᐳ[36]"):::bucket
    Bucket10("Bucket 10 (nullableBoundary)<br />Deps: 35, 11<br /><br />ROOT PgSelectSingle{8}ᐸmessagesᐳ[35]<br />1: <br />ᐳ: 38, 41<br />2: PgSelect[42]<br />3: PgSelectRows[47]<br />ᐳ: First[46], PgSelectSingle[48]"):::bucket
    Bucket11("Bucket 11 (nullableBoundary)<br />Deps: 36, 37, 11, 40<br /><br />ROOT Edge{9}[37]"):::bucket
    Bucket12("Bucket 12 (nullableBoundary)<br />Deps: 48<br /><br />ROOT PgSelectSingle{10}ᐸusersᐳ[48]"):::bucket
    Bucket13("Bucket 13 (nullableBoundary)<br />Deps: 49, 11<br /><br />ROOT PgSelectSingle{11}ᐸmessagesᐳ[49]<br />1: <br />ᐳ: 51, 53<br />2: PgSelect[54]<br />3: PgSelectRows[59]<br />ᐳ: First[58], PgSelectSingle[60]"):::bucket
    Bucket14("Bucket 14 (nullableBoundary)<br />Deps: 60<br /><br />ROOT PgSelectSingle{13}ᐸusersᐳ[60]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3
    Bucket3 --> Bucket4 & Bucket5
    Bucket4 --> Bucket8
    Bucket5 --> Bucket9
    Bucket8 --> Bucket10
    Bucket9 --> Bucket11
    Bucket10 --> Bucket12
    Bucket11 --> Bucket13
    Bucket13 --> Bucket14

    %% plan dependencies
    PgSelect8[["PgSelect[8∈0] ➊<br />ᐸforumsᐳ<br />More deps:<br />- Object[11]"]]:::plan
    Lambda13{{"Lambda[13∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[ undefined, 'EXCLUSIVELY' ]ᐳ[65]"}}:::plan
    Lambda13 --> PgSelect8
    Object11{{"Object[11∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ<br />Dependents: 4"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access10{{"Access[10∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access9 & Access10 --> Object11
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access9
    __Value2 --> Access10
    PgSelectRows14[["PgSelectRows[14∈0] ➊"]]:::plan
    PgSelect8 --> PgSelectRows14
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸincludeArchivedConditionᐳ<br />More deps:<br />- Constantᐸ[HIDDEN]ᐳ[66]"}}:::plan
    __Item15[/"__Item[15∈1]<br />ᐸ14ᐳ"\]:::itemplan
    PgSelectRows14 ==> __Item15
    PgSelectSingle16{{"PgSelectSingle[16∈1]<br />ᐸforumsᐳ"}}:::plan
    __Item15 --> PgSelectSingle16
    PgSelect20[["PgSelect[20∈2]<br />ᐸmessagesᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression19{{"PgClassExpression[19∈2]<br />ᐸ__forums__.”id”ᐳ"}}:::plan
    PgClassExpression25{{"PgClassExpression[25∈2]<br />ᐸ__forums__...chived_at”ᐳ"}}:::plan
    PgClassExpression19 & PgClassExpression25 & Lambda28 --> PgSelect20
    PgClassExpression17{{"PgClassExpression[17∈2]<br />ᐸ__forums__.”name”ᐳ"}}:::plan
    PgSelectSingle16 --> PgClassExpression17
    PgSelectSingle16 --> PgClassExpression19
    Connection24[["Connection[24∈2]<br />ᐸ20ᐳ"]]:::plan
    PgSelect20 --> Connection24
    PgSelectSingle16 --> PgClassExpression25
    ConnectionItems29[["ConnectionItems[29∈2]"]]:::plan
    Connection24 --> ConnectionItems29
    Access39{{"Access[39∈3]<br />ᐸ20.cursorDetailsᐳ"}}:::plan
    PgSelect20 --> Access39
    __Item34[/"__Item[34∈8]<br />ᐸ29ᐳ"\]:::itemplan
    ConnectionItems29 ==> __Item34
    PgSelectSingle35{{"PgSelectSingle[35∈8]<br />ᐸmessagesᐳ"}}:::plan
    __Item34 --> PgSelectSingle35
    Edge37{{"Edge[37∈9]"}}:::plan
    __Item36[/"__Item[36∈9]<br />ᐸ29ᐳ"\]:::itemplan
    PgCursor40{{"PgCursor[40∈9]"}}:::plan
    __Item36 & PgCursor40 --> Edge37
    __Item36 & Access39 --> PgCursor40
    ConnectionItems29 ==> __Item36
    PgSelect42[["PgSelect[42∈10]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression41{{"PgClassExpression[41∈10]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression41 --> PgSelect42
    PgClassExpression38{{"PgClassExpression[38∈10]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle35 --> PgClassExpression38
    PgSelectSingle35 --> PgClassExpression41
    First46{{"First[46∈10]"}}:::plan
    PgSelectRows47[["PgSelectRows[47∈10]"]]:::plan
    PgSelectRows47 --> First46
    PgSelect42 --> PgSelectRows47
    PgSelectSingle48{{"PgSelectSingle[48∈10]<br />ᐸusersᐳ"}}:::plan
    First46 --> PgSelectSingle48
    PgSelectSingle49{{"PgSelectSingle[49∈11]<br />ᐸmessagesᐳ"}}:::plan
    __Item36 --> PgSelectSingle49
    PgClassExpression50{{"PgClassExpression[50∈12]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle48 --> PgClassExpression50
    PgClassExpression52{{"PgClassExpression[52∈12]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression50 o--o PgClassExpression52
    PgSelect54[["PgSelect[54∈13]<br />ᐸusersᐳ<br />More deps:<br />- Object[11]"]]:::plan
    PgClassExpression53{{"PgClassExpression[53∈13]<br />ᐸ__messages...author_id”ᐳ"}}:::plan
    PgClassExpression53 --> PgSelect54
    PgClassExpression51{{"PgClassExpression[51∈13]<br />ᐸ__messages__.”body”ᐳ"}}:::plan
    PgSelectSingle49 --> PgClassExpression51
    PgSelectSingle49 --> PgClassExpression53
    First58{{"First[58∈13]"}}:::plan
    PgSelectRows59[["PgSelectRows[59∈13]"]]:::plan
    PgSelectRows59 --> First58
    PgSelect54 --> PgSelectRows59
    PgSelectSingle60{{"PgSelectSingle[60∈13]<br />ᐸusersᐳ"}}:::plan
    First58 --> PgSelectSingle60
    PgClassExpression61{{"PgClassExpression[61∈14]<br />ᐸ__users__.”username”ᐳ"}}:::plan
    PgSelectSingle60 --> PgClassExpression61
    PgClassExpression62{{"PgClassExpression[62∈14]<br />ᐸ__users__....vatar_url”ᐳ"}}:::plan
    PgClassExpression61 o--o PgClassExpression62

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect8,Access9,Access10,Object11,Lambda13,PgSelectRows14,Lambda28 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item15,PgSelectSingle16 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression17,PgClassExpression19,PgSelect20,Connection24,PgClassExpression25,ConnectionItems29 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,Access39 bucket3
    classDef bucket4 stroke:#0000ff
    class Bucket4 bucket4
    classDef bucket5 stroke:#7fff00
    class Bucket5 bucket5
    classDef bucket8 stroke:#dda0dd
    class Bucket8,__Item34,PgSelectSingle35 bucket8
    classDef bucket9 stroke:#ff0000
    class Bucket9,__Item36,Edge37,PgCursor40 bucket9
    classDef bucket10 stroke:#ffff00
    class Bucket10,PgClassExpression38,PgClassExpression41,PgSelect42,First46,PgSelectRows47,PgSelectSingle48 bucket10
    classDef bucket11 stroke:#00ffff
    class Bucket11,PgSelectSingle49 bucket11
    classDef bucket12 stroke:#4169e1
    class Bucket12,PgClassExpression50,PgClassExpression52 bucket12
    classDef bucket13 stroke:#3cb371
    class Bucket13,PgClassExpression51,PgClassExpression53,PgSelect54,First58,PgSelectRows59,PgSelectSingle60 bucket13
    classDef bucket14 stroke:#a52a2a
    class Bucket14,PgClassExpression61,PgClassExpression62 bucket14

